# Contributor: Martell Malone <martell malone at gmail dot com>

_realname=glew

pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}"
pkgver=1.10.0
pkgrel=1
arch=('any')
pkgdesc="GLEW, The OpenGL Extension Wrangler Library (mingw-w64)"
depends=('')
makedepends=("${MINGW_PACKAGE_PREFIX}-gcc" "xz")
groups=("${MINGW_PACKAGE_PREFIX}")
license=('Modified BSD/MIT/GPL')
url="http://glew.sourceforge.net/"
options=('strip' '!libtool' 'staticlibs')
source=("http://sourceforge.net/projects/glew/files/glew/$pkgver/glew-$pkgver.tgz")
md5sums=('2f09e5e6cb1b9f3611bcac79bc9c2d5d')
         
prepare() {
  cd "$srcdir/glew-$pkgver"
  #wget -O config/config.guess 'http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'
}

build() {
  cd "$srcdir/glew-$pkgver"
  cp config/Makefile.mingw config/Makefile.msys
  MSYSTEM=MINGW make
}

package () {
  cd "$srcdir/glew-$pkgver"
  MSYSTEM=MINGW make GLEW_DEST="${pkgdir}${MINGW_PREFIX}" install.all

  # Fix pkgconfig files
  sed -i "s|${pkgdir}${MINGW_PREFIX}|${MINGW_PREFIX}|g" \
    ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/glew.pc \
    ${pkgdir}${MINGW_PREFIX}/lib/pkgconfig/glewmx.pc
}
